package cn.hxzy.client;

import cn.hxzy.domain.Course;
import cn.hxzy.domain.Section;
import cn.hxzy.response.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 课程的feign接口
 */
@FeignClient(name = "course-service",contextId = "course-service-1")
public interface CourseClient {
    /**
     * 根据课程编号获取课程信息
     * @param courseId 课程编号
     * @return
     */
    @GetMapping("/course/getCourse/{courseId}")
    public R<Course> getCourseById(@PathVariable int courseId);

    /**
     * 添加课程
     * @param course 课程信息
     * @return
     */
    @PostMapping("/course/save")
    public R saveCourse(@RequestBody Course course);
    /**
     * 修改课程信息
     * @param course 课程信息
     * @return
     */
    @PutMapping("/course/update")
    public R updateCourse(@RequestBody Course course);
    /**
     * 删除课程
     * @param courseId 课程编号
     * @return
     */
    @DeleteMapping("/course/delete")
    public R deleteCourseById(@RequestParam int courseId);



    /**
     * 根据章节Id查询所有章节
     */
    @GetMapping("/section/selectList")
    public R<List<Section>> sectionList(@RequestParam Integer chapterId);
}
